package com.sinothk.cloud.mq.kafka;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "Kafka模块")
@RequestMapping("/kafka")
@RestController
public class KafkaController {

//    private final KafkaProducer kafkaProducer;
//
//    public KafkaController(KafkaProducer kafkaProducer) {
//        this.kafkaProducer = kafkaProducer;
//    }

//    @GetMapping("/test")
//    public String aVoid(String str){
//        try {
////            kafkaProducer.data(str);
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return "成功==============================";
//    }

    @ApiOperation(value = "写入Info日志")
    @ApiImplicitParam(name = "content", value = "日志内容", required = true)
    @GetMapping("/info")
    public String info(@RequestParam(value = "content") String content) {
        return "kafka Info log";
    }

    @ApiOperation(value = "写入Error日志")
    @ApiImplicitParam(name = "content", value = "日志内容", required = true)
    @GetMapping("/error")
    public String error(@RequestParam(value = "content") String content) {
        return "kafka Error log";
    }
}
